//
//  HNSNProductListCell.m
//  ZYManagementSystem
//
//  Created by 星道 on 17/6/14.
//  Copyright © 2017年 焕宁. All rights reserved.
//

#import "HNSNProductListCell.h"

@implementation HNSNProductListCell
{
    IBOutlet UILabel *_ID;
    IBOutlet UILabel *_Title;
    IBOutlet UILabel *SubTitle;
    IBOutlet UIImageView *_RedCycle;
}

- (void)setModel:(HNSNProductListModel *)Model
{
    _Model = Model;

    if (Model.petName){


        _ID.text = Model.username_Sub;
        _Title.text = Model.petName;
        SubTitle.text = ([Model.isUsed integerValue] == 1)?@"已消费":@"消费确认";
    } else {

        _ID.text = [Model.ID stringValue];
        _Title.text = Model.name;
        SubTitle.text = @"购买记录";
    }


}


- (void)setOrderModel:(HNSNProductOrderModel *)OrderModel
{
    _OrderModel = OrderModel;

    // 红点的显示与否
    if ([OrderModel.isViewed isEqualToNumber:@1])
    {
        _RedCycle.hidden = NO;// 显示
    }
    else
    {
        _RedCycle.hidden = YES;// 隐藏
    }

    // 0课程结算 1佣金金额
    if ([OrderModel.type isEqualToNumber:@0])
    {
        _ID.text = [@"课程结算金额:" stringByAppendingString:[OrderModel.settlementPrice stringValue]];
        _Title.text = OrderModel.T_name;
    }
    else
    {
        _ID.text = [@"佣金金额:" stringByAppendingString:[@([OrderModel.actualPaid floatValue] * 0.05) stringValue]];
        _Title.text = OrderModel.C_name;
    }
    SubTitle.text = @"详情";
}
@end
